﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IReadOnlyRepository.cs" company="Concept Architecture">
//   (c) 2010 Muhammad Umer Farooq
// </copyright>
// <summary>
//   Defines the <seealso cref="Hisaab.Data.Interfaces.IReadOnlyRepository&lt;T&gt;" /> interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Hisaab.Data.Interfaces
{
    using System;
    using System.Linq;
    using System.Linq.Expressions;

    /// <summary>
    /// Defines the <seealso cref="Hisaab.Data.Interfaces.IReadOnlyRepository&lt;T&gt;"/> interface.
    /// </summary>
    /// <typeparam name="T">Type of repository</typeparam>
    public interface IReadOnlyRepository<T>
    {
        /// <summary>
        /// Gets the filtered.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <param name="pageNo">The page no.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <returns>List of filtered items</returns>
        IQueryable<T> Query(T filter, int? pageNo = null, int? pageSize = null);

        /// <summary>
        /// Queries the specified filter.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <param name="pageNo">The page no.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <returns>List of filtered items</returns>
        IQueryable<T> Filter(Expression<Func<T, bool>> filter, int? pageNo = null, int? pageSize = null);

        /// <summary>
        /// Finds the by id.
        /// </summary>
        /// <param name="id">The id of entity</param>
        /// <returns>Entity matching by id</returns>
        T FindById(int id);
    }
}